package com.qf.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.pojo.DtsUser;
import com.qf.vo.DayStatis;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author zhaojian
 * @since 2021-05-12
 */
public interface DtsUserMapper extends BaseMapper<DtsUser> {

    //日期对应的用户数
    @Select("select \n" +
            " count(1) as cnts, \n" +
            "\t date_formAt( add_time, '%Y-%m-%d') as dayStr \n" +
            "form dts_user \n" +
            "where date_formAt( add_time, '%Y-%m-%d') > date_formAt( date_add( now(), interval - #{statisDaysRang} day), '%Y-%m-%d') \n" +
            "group by date_formAt( add_time, '%Y-%m-%d') " )
    List<DayStatis> findUserDayStatis(@Param("statisDaysRang") int statisDaysRang);











}
